package model.webService;

import java.net.Socket;

import view.Splash;
import android.util.Log;

public class WebServiceConnector 
{
	private ClientThread client;
	
	private Splash _splash;
	
	public WebServiceConnector()
	{
		
	}
		
	public void connectToServer(Splash splash)
	{
		try 
		{
			_splash = splash;
			client = new ClientThread(_splash);
			new Thread(client).start();
		} catch (Exception e)
		{
			Log.e("WEBSERVICE", e.toString());
		}
	}
	
	public void subscribeToSnippet(String snippetID)
	{
		client.subscribeToSnippet(snippetID);
	}
	
	public void unSubscribeToSnippet(String snippetID)
	{
		client.unSubscribeToSnippet(snippetID);
	}
	
	public void disconnectFromServer()
	{
		client.logOut();
	}	
	
	public void getSnippet(String id)
	{
		client.getSnippet(id);
	}

	public void handleSubscriptions(String subscribeIds, String unSubscribeIds) 
	{
		client.handleSubscriptions(subscribeIds, unSubscribeIds);
	}
}
